home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / gridex / frmlist.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-01-02  |  7.0 KB  |  229 lines

  1. VERSION 5.00
  2. Object = "{BA7155BB-813E-11D1-B8F4-0080ADA85B53}#1.0#0"; "JSGridEX.ocx"
  3. Begin VB.Form frmList 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   3075
  7.    ClientLeft      =   1365
  8.    ClientTop       =   2865
  9.    ClientWidth     =   6660
  10.    Icon            =   "frmList.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   205
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   444
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   2  'CenterScreen
  19.    Begin VB.CommandButton cmdCancel 
  20.       Cancel          =   -1  'True
  21.       Caption         =   "Cancel"
  22.       BeginProperty Font 
  23.          Name            =   "Tahoma"
  24.          Size            =   8.25
  25.          Charset         =   0
  26.          Weight          =   400
  27.          Underline       =   0   'False
  28.          Italic          =   0   'False
  29.          Strikethrough   =   0   'False
  30.       EndProperty
  31.       Height          =   330
  32.       Left            =   5415
  33.       TabIndex        =   2
  34.       Top             =   735
  35.       Width           =   1200
  36.    End
  37.    Begin VB.CommandButton cmdOK 
  38.       Caption         =   "OK"
  39.       Default         =   -1  'True
  40.       BeginProperty Font 
  41.          Name            =   "Tahoma"
  42.          Size            =   8.25
  43.          Charset         =   0
  44.          Weight          =   400
  45.          Underline       =   0   'False
  46.          Italic          =   0   'False
  47.          Strikethrough   =   0   'False
  48.       EndProperty
  49.       Height          =   330
  50.       Left            =   5415
  51.       TabIndex        =   1
  52.       Top             =   360
  53.       Width           =   1200
  54.    End
  55.    Begin JSGridEX.GridEX gexList 
  56.       Height          =   2550
  57.       Left            =   75
  58.       TabIndex        =   0
  59.       Top             =   390
  60.       Width           =   5220
  61.       _ExtentX        =   9208
  62.       _ExtentY        =   4498
  63.       MethodHoldFields=   -1  'True
  64.       ContScroll      =   -1  'True
  65.       GroupByBoxInfoText=   ""
  66.       AllowEdit       =   0   'False
  67.       GroupByBoxVisible=   0   'False
  68.       BackColor       =   -2147483624
  69.       ForeColor       =   -2147483625
  70.       ImageCount      =   3
  71.       ImagePicture1   =   "frmList.frx":000C
  72.       ImagePicture2   =   "frmList.frx":011E
  73.       ImagePicture3   =   "frmList.frx":0438
  74.       ColumnCount     =   3
  75.       CardCaption1    =   -1  'True
  76.       ColHeaderIcon1  =   1
  77.       ColKey1         =   "Icon"
  78.       ColWidth1       =   330
  79.       ColumnType1     =   1
  80.       ColEditType1    =   0
  81.       ColKey2         =   "ID"
  82.       ColWidth2       =   1200
  83.       ColEditType2    =   0
  84.       ColKey3         =   "Name"
  85.       ColWidth3       =   3390
  86.       ColEditType3    =   0
  87.       GridLines       =   0   'False
  88.       BackColorBkg    =   -2147483624
  89.       ColumnHeaderHeight=   285
  90.    End
  91.    Begin VB.Label lblInfo 
  92.       AutoSize        =   -1  'True
  93.       BeginProperty Font 
  94.          Name            =   "Tahoma"
  95.          Size            =   8.25
  96.          Charset         =   0
  97.          Weight          =   400
  98.          Underline       =   0   'False
  99.          Italic          =   0   'False
  100.          Strikethrough   =   0   'False
  101.       EndProperty
  102.       Height          =   195
  103.       Left            =   90
  104.       TabIndex        =   3
  105.       Top             =   90
  106.       Width           =   45
  107.    End
  108. Attribute VB_Name = "frmList"
  109. Attribute VB_GlobalNameSpace = False
  110. Attribute VB_Creatable = False
  111. Attribute VB_PredeclaredId = True
  112. Attribute VB_Exposed = False
  113. Option Explicit
  114. Dim m_OK As Boolean
  115. Public Function ChooseSupplier(ByVal dbName As String, ByVal SupplierID As String) As Variant
  116. Dim cols As JSGridEX.Columns
  117. Dim col As JSGridEX.Column
  118. Dim rsTemp As Recordset
  119.     m_OK = False
  120.     Set cols = gexList.Columns
  121.     Set col = cols("Icon")
  122.     col.DefaultIcon = 3
  123.     Set col = cols("ID")
  124.     col.Caption = "Supplier ID"
  125.     col.DataField = "SupplierID"
  126.     col.TextAlignment = jgexAlignRight
  127.     col.SortType = jgexSortTypeNumeric
  128.     Set col = cols("Name")
  129.     col.Caption = "Supplier"
  130.     col.DataField = "CompanyName"
  131.     gexList.DatabaseName = dbName
  132.     gexList.RecordSource = "Suppliers"
  133.     gexList.RecordsetType = jgexRSDAOTable
  134.     gexList.HoldFields
  135.     gexList.Rebind
  136.     gexList.SortKeys.Add 3, jgexSortAscending
  137.     Set Me.Icon = gexList.GridImages(3).Picture
  138.     Me.Caption = "Suppliers List"
  139.     lblInfo = "Select a supplier from the list:"
  140.     gexList.RefreshSort
  141.     Set rsTemp = gexList.Recordset
  142.     rsTemp.Index = "PrimaryKey"
  143.     rsTemp.Seek "=", SupplierID
  144.     If rsTemp.NoMatch Then
  145.         gexList.Row = 0
  146.     Else
  147.         gexList.MoveToBookmark rsTemp.Bookmark
  148.     End If
  149.     Show 1
  150.     If m_OK Then
  151.         If gexList.Row <> 0 Then
  152.             ChooseSupplier = gexList.Value(2)
  153.         Else
  154.             ChooseSupplier = ""
  155.         End If
  156.     Else
  157.         ChooseSupplier = Null
  158.     End If
  159.     Unload Me
  160. End Function
  161. Public Function ChooseCustomer(ByVal dbName As String, ByVal CustomerID As String) As Variant
  162. Dim cols As JSGridEX.Columns
  163. Dim col As JSGridEX.Column
  164. Dim rsTemp As Recordset
  165.     m_OK = False
  166.     Set cols = gexList.Columns
  167.     Set col = cols("Icon")
  168.     col.DefaultIcon = 3
  169.     Set col = cols("ID")
  170.     col.Caption = "Customer ID"
  171.     col.DataField = "CustomerID"
  172.     Set col = cols("Name")
  173.     col.Caption = "Customer"
  174.     col.DataField = "CompanyName"
  175.     gexList.DatabaseName = dbName
  176.     gexList.RecordSource = "Customers"
  177.     gexList.RecordsetType = jgexRSDAOTable
  178.     gexList.HoldFields
  179.     gexList.Rebind
  180.     gexList.SortKeys.Add 3, jgexSortAscending
  181.     Set Me.Icon = gexList.GridImages(2).Picture
  182.     Me.Caption = "Customer List"
  183.     lblInfo = "Select a customer from the list:"
  184.     gexList.RefreshSort
  185.     Set rsTemp = gexList.Recordset
  186.     rsTemp.Index = "PrimaryKey"
  187.     rsTemp.Seek "=", CustomerID
  188.     If rsTemp.NoMatch Then
  189.         gexList.Row = 0
  190.     Else
  191.         gexList.MoveToBookmark rsTemp.Bookmark
  192.     End If
  193.     Show 1
  194.     If m_OK Then
  195.         If gexList.Row <> 0 Then
  196.             ChooseCustomer = gexList.Value(2)
  197.         Else
  198.             ChooseCustomer = ""
  199.         End If
  200.     Else
  201.         ChooseCustomer = Null
  202.     End If
  203.     Unload Me
  204. End Function
  205. Private Sub cmdCancel_Click()
  206.     Hide
  207. End Sub
  208. Private Sub cmdOK_Click()
  209.     m_OK = True
  210.     Hide
  211. End Sub
  212. Private Sub gexList_ColumnHeaderClick(Column As JSGridEX.Column)
  213.     If Column.Index <> 1 Then
  214.         If Column.SortOrder = jgexSortNone Then
  215.             gexList.SortKeys.Clear
  216.             gexList.SortKeys.Add Column.Index, jgexSortAscending
  217.         Else
  218.             If gexList.SortKeys(1).SortOrder = jgexSortAscending Then
  219.                 gexList.SortKeys(1).SortOrder = jgexSortDescending
  220.             Else
  221.                 gexList.SortKeys(1).SortOrder = jgexSortAscending
  222.             End If
  223.         End If
  224.     End If
  225. End Sub
  226. Private Sub gexList_DblClick()
  227.     cmdOK_Click
  228. End Sub
  229.